﻿namespace _6_OOP;

internal class Being
{
}

internal class Person
{
    public string Name { get; set; }
}

internal class Circle
{
    private int radius;

    public void SetRadius(int radius)
    {
        this.radius = radius;
    }

    public double Area()
    {
        return radius * radius * Math.PI;
    }
}

internal class MyFriend
{
    private readonly DateTime born;
    private readonly string name;

    public MyFriend(string name, DateTime born)
    {
        this.name = name;
        this.born = born;
    }

    public void Info()
    {
        Console.WriteLine($"{name} {born.Year}");
    }
}

internal class Circle1
{
    public Circle1(int radius)
    {
        Console.WriteLine(radius);
    }

    public Circle1() : this(0)
    {
    }
}

internal class Program
{
    private static void Main(string[] args)
    {
        #region 1_对象

        //var b = new Being();
        //Console.WriteLine(b.ToString());

        #endregion

        #region 2_对象属性

        //var p1 = new Person { Name = "张三" };
        //var p2 = new Person();
        //p2.Name = "李四";
        //Console.WriteLine(p1.Name);
        //Console.WriteLine(p2.Name);

        #endregion

        #region 3_对象方法

        //var c = new Circle();
        //c.SetRadius(5);

        //Console.WriteLine(c.Area());

        #endregion

        #region 4_访问修饰符

        // public: 公有, 都可以访问
        // private: 私有, 只能本类访问, 想要外部访问, 需要提供getter和setter
        // protected: 保护, 只能本类和子类访问, 想要外部访问, 需要提供getter和setter
        // internal: 内部, 只能本程序集访问, 想要外部访问, 需要提供getter和setter
        // protected internal: 内部保护, 只能本程序集和子类访问, 想要外部访问, 需要提供getter和setter
        // private protected: 私有保护, 只能本类和子类访问, 想要外部访问, 需要提供getter和setter

        #endregion

        #region 5_构造函数

        //var p = new Person();
        //Console.WriteLine(p.Name);
        //var name = "Lenka";
        //var born = new DateTime(1990, 3, 5);
        //var friend = new MyFriend(name, born);
        //friend.Info();

        //new Circle1(5);
        //new Circle1();

        #endregion

        #region 7_析构函数

        //var p = new Person();
        //p.Name = "张三";
        //Console.WriteLine(p.Name);
        //Console.WriteLine(p.ToString());

        #endregion
    }
}